home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-pppext-hdlc-framing-00.txt < prev    next >
Text File  |  1993-07-08  |  34KB  |  1,158 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                        W A Simpson
  8. Internet Draft                                                Daydreamer
  9. expires in six months                                          July 1993
  10.  
  11.  
  12.                             PPP HDLC Framing
  13.  
  14.  
  15.  
  16. Status of this Memo
  17.  
  18.    This document is the product of the Point-to-Point Protocol Working
  19.    Group of the Internet Engineering Task Force (IETF).  Comments should
  20.    be submitted to the ietf-ppp@ucdavis.edu mailing list.
  21.  
  22.    Distribution of this memo is unlimited.
  23.  
  24.    This document is an Internet Draft.  Internet Drafts are working
  25.    documents of the Internet Engineering Task Force (IETF), its Areas,
  26.    and its Working Groups.  Note that other groups may also distribute
  27.    working documents as Internet Drafts.
  28.  
  29.    Internet Drafts are draft documents valid for a maximum of six
  30.    months.  Internet Drafts may be updated, replaced, or obsoleted by
  31.    other documents at any time.  It is not appropriate to use Internet
  32.    Drafts as reference material or to cite them other than as a
  33.    ``working draft'' or ``work in progress.''
  34.  
  35.    Please check the 1id-abstracts.txt listing contained in the
  36.    internet-drafts Shadow Directories on nic.ddn.mil, nnsc.nsf.net,
  37.    nic.nordu.net, ftp.nisc.sri.com, or munnari.oz.au to learn the
  38.    current status of any Internet Draft.
  39.  
  40. Abstract
  41.  
  42.    The Point-to-Point Protocol (PPP) [1] provides a method for
  43.    transmitting multi-protocol datagrams over point-to-point links.
  44.  
  45.    This document describes the use of HDLC for framing PPP encapsulated
  46.    datagrams.
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Simpson                  expires in six months                  [Page i]
  59. DRAFT                         PPP Framing                      July 1993
  60.  
  61.  
  62. 1.  Introduction
  63.  
  64.    This specification provides for framing over both bit-oriented and
  65.    octet-oriented synchronous links, and asynchronous links with 8 bits
  66.    of data and no parity.  These links MUST be full-duplex, but MAY be
  67.    either dedicated or circuit-switched.  PPP uses HDLC as a basis for
  68.    the framing.
  69.  
  70.    An escape mechanism is specified to allow control data such as
  71.    XON/XOFF to be transmitted transparently over the link, and to remove
  72.    spurious control data which may be injected into the link by
  73.    intervening hardware and software.
  74.  
  75.    Some protocols expect error free transmission, and either provide
  76.    error detection only on a conditional basis, or do not provide it at
  77.    all.  PPP uses the HDLC Frame Check Sequence for error detection.
  78.    This is commonly available in hardware implementations, and a
  79.    software implementation is provided.
  80.  
  81.  
  82. 1.1.  Specification of Requirements
  83.  
  84.    In this document, several words are used to signify the requirements
  85.    of the specification.  These words are often capitalized.
  86.  
  87.    MUST      This word, or the adjective "required", means that the
  88.              definition is an absolute requirement of the specification.
  89.  
  90.    MUST NOT  This phrase means that the definition is an absolute
  91.              prohibition of the specification.
  92.  
  93.    SHOULD    This word, or the adjective "recommended", means that there
  94.              may exist valid reasons in particular circumstances to
  95.              ignore this item, but the full implications should be
  96.              understood and carefully weighed before choosing a
  97.              different course.
  98.  
  99.    MAY       This word, or the adjective "optional", means that this
  100.              item is one of an allowed set of alternatives.  An
  101.              implementation which does not include this option MUST be
  102.              prepared to interoperate with another implementation which
  103.              does include the option.
  104.  
  105.  
  106. 1.2.  Terminology
  107.  
  108.    This document frequently uses the following terms:
  109.  
  110.  
  111.  
  112.  
  113. Simpson                  expires in six months                  [Page 1]
  114. DRAFT                         PPP Framing                      July 1993
  115.  
  116.  
  117.    peer      The other end of the point-to-point link.
  118.  
  119.    silently discard
  120.              This means the implementation discards the packet without
  121.              further processing.  The implementation SHOULD provide the
  122.              capability of logging the error, including the contents of
  123.              the silently discarded packet, and SHOULD record the event
  124.              in a statistics counter.
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168. Simpson                  expires in six months                  [Page 2]
  169. DRAFT                         PPP Framing                      July 1993
  170.  
  171.  
  172. 2.  Physical Layer Requirements
  173.  
  174.    PPP is capable of operating across most DTE/DCE interfaces (such as,
  175.    EIA RS-232-C, EIA RS-422, EIA RS-423 and CCITT V.35).  The only
  176.    absolute requirement imposed by PPP is the provision of a full-duplex
  177.    circuit, either dedicated or circuit-switched, which can operate in
  178.    either an asynchronous (start/stop), bit-synchronous, or octet-
  179.    synchronous mode, transparent to PPP Data Link Layer frames.
  180.  
  181.    Interface Format
  182.  
  183.       PPP presents an octet interface to the physical layer.  There is
  184.       no provision for sub-octets to be supplied or accepted.
  185.  
  186.    Transmission Rate
  187.  
  188.       PPP does not impose any restrictions regarding transmission rate,
  189.       other than that of the particular DTE/DCE interface.
  190.  
  191.    Encoding
  192.  
  193.       PPP does not require any particular synchronous encoding, such as
  194.       FM, NRZ, or NRZI.  The use of various encodings and scrambling is
  195.       the responsibility of the DTE/DCE equipment in use, and is outside
  196.       the scope of this specification.
  197.  
  198.       While PPP will operate without regard to the underlying
  199.       representation of the octet stream, lack of standards for
  200.       transmission will hinder interoperability as surely as lack of
  201.       data link standards.  At speeds of up to 2.0 Mbps, NRZ is
  202.       currently most widely available, and on that basis is recommended
  203.       as a default.
  204.  
  205.       When some configuration of the encoding is allowed, NRZI is
  206.       recommended as an alternative, because of its relative immunity to
  207.       signal inversion configuration errors, and instances when it MAY
  208.       allow connection without an expensive DSU/CSU.  Unfortunately,
  209.       NRZI encoding obviates the (1 + x) factor of the 16-bit FCS, so
  210.       that one error in 2**15 goes undetected instead of one in 2**16,
  211.       and triple errors are not detected.  Therefore, when NRZI is in
  212.       use, it is recommended that the 32-bit FCS be negotiated, which
  213.       does not include the (1 + x) factor.
  214.  
  215.       At speeds of up to 45 Mbps, some implementors have chosen the ANSI
  216.       High Speed Synchronous Interface as the underlying transport.
  217.       [Anybody have any restrictions or references?]
  218.  
  219.  
  220.  
  221.  
  222.  
  223. Simpson                  expires in six months                  [Page 3]
  224. DRAFT                         PPP Framing                      July 1993
  225.  
  226.  
  227.    Control Signals
  228.  
  229.       PPP does not require the use of modem control signals, such as
  230.       Request To Send (RTS), Clear To Send (CTS), Data Carrier Detect
  231.       (DCD), and Data Terminal Ready (DTR).
  232.  
  233.       When available, using such signals can allow greater functionality
  234.       and performance.  In particular, such signals SHOULD be used to
  235.       signal the Up and Down events in the LCP Option Negotiation
  236.       Automaton [1].  When such signals are not available, the
  237.       implementation MUST signal the Up event to LCP upon
  238.       initialization, and SHOULD NOT signal the Down event.
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278. Simpson                  expires in six months                  [Page 4]
  279. DRAFT                         PPP Framing                      July 1993
  280.  
  281.  
  282. 3.  The Data Link Layer
  283.  
  284.    PPP uses the principles, terminology, and frame structure of the
  285.    International Organization For Standardization's (ISO) High-level
  286.    Data Link Control (HDLC) procedures (ISO 3309-1979 [2]), as modified
  287.    by ISO 3309:1984/PDAD1 "Addendum 1: Start/stop transmission" [3].
  288.    ISO 3309-1979 specifies the HDLC frame structure for use in
  289.    synchronous environments.  ISO 3309:1984/PDAD1 specifies proposed
  290.    modifications to ISO 3309-1979 to allow its use in asynchronous
  291.    environments.
  292.  
  293.    The PPP control procedures use the definitions and Control field
  294.    encodings standardized in ISO 4335-1979 [4] and ISO 4335-
  295.    1979/Addendum 1-1979 [5].  The PPP frame structure is also consistent
  296.    with CCITT Recommendation X.25 LAPB [6], and CCITT Recommendation
  297.    Q.922 [7], since those are also based on HDLC.
  298.  
  299.    The purpose of this specification is not to document what is already
  300.    standardized in ISO 3309.  It is assumed that the reader is already
  301.    familiar with HDLC, or has access to a copy of [2] or [6].  Instead,
  302.    this paper attempts to give a concise summary and point out specific
  303.    options and features used by PPP.  Since "Addendum 1: Start/stop
  304.    transmission", is not yet standardized and widely available, it is
  305.    summarized in a following section.
  306.  
  307.    To remain consistent with standard Internet practice, and avoid
  308.    confusion for people used to reading RFCs, all binary numbers in the
  309.    following descriptions are in Most Significant Bit to Least
  310.    Significant Bit order, reading from left to right, unless otherwise
  311.    indicated.  Note that this is contrary to standard ISO and CCITT
  312.    practice which orders bits as transmitted (network bit order).  Keep
  313.    this in mind when comparing this document with the international
  314.    standards documents.
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333. Simpson                  expires in six months                  [Page 5]
  334. DRAFT                         PPP Framing                      July 1993
  335.  
  336.  
  337. 3.1.  Frame Format
  338.  
  339.    A summary of the PPP HDLC frame structure is shown below.  This
  340.    figure does not include start/stop bits (for asynchronous links), nor
  341.    any bits or octets inserted for transparency.  The fields are
  342.    transmitted from left to right.
  343.  
  344.            +----------+----------+----------+
  345.            |   Flag   | Address  | Control  |
  346.            | 01111110 | 11111111 | 00000011 |
  347.            +----------+----------+----------+
  348.            +----------+-------------+---------+
  349.            | Protocol | Information | Padding |
  350.            | 16 bits  |      *      |    *    |
  351.            +----------+-------------+---------+
  352.            +----------+----------+-----------------
  353.            |   FCS    |   Flag   | Inter-frame Fill
  354.            | 16 bits  | 01111110 | or next Address
  355.            +----------+----------+-----------------
  356.  
  357.    The Protocol, Information and Padding fields are described in the
  358.    Point-to-Point Protocol Encapsulation [1].
  359.  
  360.    Flag Sequence
  361.  
  362.       The Flag Sequence indicates the beginning or end of a frame, and
  363.       always consists of the binary sequence 01111110 (hexadecimal
  364.       0x7e).
  365.  
  366.       The Flag Sequence is a frame separator.  Only one Flag Sequence is
  367.       required between two frames.  Two consecutive Flag Sequences
  368.       constitute an empty frame, which is ignored, and not counted as a
  369.       FCS error.
  370.  
  371.    Address Field
  372.  
  373.       The Address field is a single octet and contains the binary
  374.       sequence 11111111 (hexadecimal 0xff), the All-Stations address.
  375.       PPP does not assign individual station addresses.  The All-
  376.       Stations address MUST always be recognized and received.  The use
  377.       of other address lengths and values may be defined at a later
  378.       time, or by prior agreement.  Frames with unrecognized Addresses
  379.       SHOULD be silently discarded, and reported through the normal
  380.       network management facility.
  381.  
  382.    Control Field
  383.  
  384.       The Control field is a single octet and contains the binary
  385.  
  386.  
  387.  
  388. Simpson                  expires in six months                  [Page 6]
  389. DRAFT                         PPP Framing                      July 1993
  390.  
  391.  
  392.       sequence 00000011 (hexadecimal 0x03), the Unnumbered Information
  393.       (UI) command with the P/F bit set to zero.  The use of other
  394.       Control field values may be defined at a later time, or by prior
  395.       agreement.  Frames with unrecognized Control field values SHOULD
  396.       be silently discarded.
  397.  
  398.    Frame Check Sequence (FCS) Field
  399.  
  400.       The Frame Check Sequence field is normally 16 bits (two octets).
  401.       The use of other FCS lengths may be defined at a later time, or by
  402.       prior agreement.  The FCS is transmitted with the coefficient of
  403.       the highest term first.
  404.  
  405.       The FCS field is calculated over all bits of the Address, Control,
  406.       Protocol, Information and Padding fields, not including any start
  407.       and stop bits (asynchronous) nor any bits (synchronous) or octets
  408.       (asynchronous) inserted for transparency.  This also does not
  409.       include the Flag Sequences or the FCS field itself.
  410.  
  411.          Note: When octets are received which are flagged in the Async-
  412.          Control-Character-Map, they are discarded before calculating
  413.          the FCS.
  414.  
  415.       For more information on the specification of the FCS, see ISO 3309
  416.       [2] or CCITT X.25 [6].
  417.  
  418.    The end of the Information and Padding fields is found by locating
  419.    the closing Flag Sequence and removing the Frame Check Sequence
  420.    field.
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443. Simpson                  expires in six months                  [Page 7]
  444. DRAFT                         PPP Framing                      July 1993
  445.  
  446.  
  447. 3.2.  Modification of the Basic Frame
  448.  
  449.    The Link Control Protocol can negotiate modifications to the basic
  450.    HDLC frame structure.  However, modified frames will always be
  451.    clearly distinguishable from standard frames.
  452.  
  453.    Address-and-Control-Field-Compression
  454.  
  455.       When using the default HDLC framing, the Address and Control
  456.       fields contain the hexadecimal values 0xff and 0x03 respectively.
  457.  
  458.       On transmission, compressed Address and Control fields are formed
  459.       by simply omitting them.
  460.  
  461.       On reception, the Address and Control fields are decompressed by
  462.       examining the first two octets.  If they contain the values 0xff
  463.       and 0x03, they are assumed to be the Address and Control fields.
  464.       If not, it is assumed that the fields were compressed and were not
  465.       transmitted.
  466.  
  467.       By definition, the first octet of a two octet Protocol field will
  468.       never be 0xff (since it is not even).  The Protocol field value
  469.       0x00ff is not allowed (reserved) to avoid ambiguity when
  470.       Protocol-Field-Compression is enabled and the first Information
  471.       field octet is 0x03.
  472.  
  473.       When other Address or Control field values are in use, Address-
  474.       and-Control-Field-Compression MUST NOT be negotiated.
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498. Simpson                  expires in six months                  [Page 8]
  499. DRAFT                         PPP Framing                      July 1993
  500.  
  501.  
  502. 4.  Bit-synchronous HDLC
  503.  
  504.    This section summarizes the considerations for interoperability of
  505.    ISO 3309-1979, as applied in the Point-to-Point Protocol to bit-
  506.    synchronous links.
  507.  
  508.    Flag Sequence
  509.  
  510.       The Flag Sequence indicates the beginning or end of a frame, and
  511.       is used for frame synchronization.  The bit stream is examined on
  512.       a bit-by-bit basis for the binary sequence 01111110 (hexadecimal
  513.       0x7e).
  514.  
  515.       The "shared zero mode" Flag Sequence "011111101111110" SHOULD NOT
  516.       be used.  When not avoidable, such an implementation MUST ensure
  517.       that the first Flag Sequence detected (the end of the frame) is
  518.       promptly communicated to the link layer.  Use of the shared zero
  519.       mode hinders interoperability with synchronous-to-asynchronous
  520.       converters.
  521.  
  522.    Transparency
  523.  
  524.       The transmitter examines the entire frame between the two Flag
  525.       Sequences.  A "0" bit is inserted after all sequences of five
  526.       contiguous "1" bits (including the last 5 bits of the FCS) to
  527.       ensure that a Flag Sequence is not simulated.
  528.  
  529.       When receiving, any "0" bit that directly follows five contiguous
  530.       "1" bits is discarded.
  531.  
  532.       There may be some use of synchronous-to-asynchronous converters
  533.       (some built into modems) in point-to-point links resulting in a
  534.       synchronous PPP implementation on one end of a link and an
  535.       asynchronous implementation on the other.  It is the
  536.       responsibility of the converter to do all mapping conversions
  537.       during operation.  To enable this functionality, bit-synchronous
  538.       PPP implementations MUST always respond to an LCP Configure-
  539.       Request specifying the Async-Control-Character-Map Configuration
  540.       Option with an LCP Configure-Ack.  However, acceptance of the
  541.       Configuration Option does not imply that the bit-synchronous
  542.       implementation will do any character mapping, since bit-
  543.       synchronous equipment uses bit-stuffing rather than character-
  544.       stuffing.  Instead, all such character mapping will be performed
  545.       by the asynchronous-to-synchronous converter.
  546.  
  547.    Aborting a Transmission
  548.  
  549.       A sequence of more than six "1" bits indicates an invalid frame,
  550.  
  551.  
  552.  
  553. Simpson                  expires in six months                  [Page 9]
  554. DRAFT                         PPP Framing                      July 1993
  555.  
  556.  
  557.       which is ignored, and not counted as a FCS error.
  558.  
  559.    Inter-frame Time Fill
  560.  
  561.       For bit-synchronous links, the Flag Sequence SHOULD be transmitted
  562.       during inter-frame time fill.  There is no provision for inter-
  563.       octet time fill.
  564.  
  565.       Mark idle (continuous ones) SHOULD NOT be used for inter-frame
  566.       time fill.  However, certain types of circuit-switched links
  567.       require the use of mark idle, particularly those that calculate
  568.       accounting based on periods of bit activity.  When mark idle is
  569.       used on a bit-synchronous link, the implementation MUST ensure at
  570.       least 15 consecutive "1" bits between Flags during the idle
  571.       period, and that the Flag Sequence is always generated at the
  572.       beginning of a frame after an idle period.
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608. Simpson                  expires in six months                 [Page 10]
  609. DRAFT                         PPP Framing                      July 1993
  610.  
  611.  
  612. 5.  Asynchronous HDLC
  613.  
  614.    This section summarizes the modifications to ISO 3309-1979 proposed
  615.    in ISO 3309:1984/PDAD1, as applied in the Point-to-Point Protocol.
  616.    These modifications allow HDLC to be used with 8-bit asynchronous
  617.    links.
  618.  
  619.    Transmission Considerations
  620.  
  621.       All octets are transmitted with one start bit, eight bits of data,
  622.       and one stop bit.  There is no provision in either PPP or ISO
  623.       3309:1984/PDAD1 for seven bit asynchronous links.
  624.  
  625.    Flag Sequence
  626.  
  627.       The Flag Sequence indicates the beginning or end of a frame.  The
  628.       octet stream is examined on an octet-by-octet basis for the value
  629.       01111110 (hexadecimal 0x7e).
  630.  
  631.    Transparency
  632.  
  633.       On asynchronous links, a character stuffing procedure is used.
  634.       The Control Escape octet is defined as binary 01111101
  635.       (hexadecimal 0x7d) where the bit positions are numbered 87654321
  636.       (not 76543210, BEWARE).
  637.  
  638.       Each end of the link maintains two Async-Control-Character-Maps.
  639.       The receiving ACCM is 32 bits, but the sending ACCM may be up to
  640.       256 bits.  This results in four distinct ACCMs, two in each
  641.       direction of the link.
  642.  
  643.       After FCS computation, the transmitter examines the entire frame
  644.       between the two Flag Sequences.  Each Flag Sequence, Control
  645.       Escape octet, and octet with value less than hexadecimal 0x20
  646.       which is flagged in the sending Async-Control-Character-Map, is
  647.       replaced by a two octet sequence consisting of the Control Escape
  648.       octet and the original octet with bit 6 complemented (exclusive-
  649.       or'd with hexadecimal 0x20).
  650.  
  651.       Prior to FCS computation, the receiver examines the entire frame
  652.       between the two Flag Sequences.  Each octet with value less than
  653.       hexadecimal 0x20 is checked.  If it is flagged in the receiving
  654.       Async-Control-Character-Map, it is simply removed (it may have
  655.       been inserted by intervening data communications equipment).  For
  656.       each Control Escape octet, that octet is also removed, but bit 6
  657.       of the following octet is complemented, unless it is the Flag
  658.       Sequence.
  659.  
  660.  
  661.  
  662.  
  663. Simpson                  expires in six months                 [Page 11]
  664. DRAFT                         PPP Framing                      July 1993
  665.  
  666.  
  667.          Note: The inclusion of all octets less than hexadecimal 0x20
  668.          allows all ASCII control characters [8] excluding DEL (Delete)
  669.          to be transparently communicated through almost all known data
  670.          communications equipment.
  671.  
  672.       The transmitter may also send octets with value in the range 0x40
  673.       through 0xff (except 0x5e) in Control Escape format.  Since these
  674.       octet values are not negotiable, this does not solve the problem
  675.       of receivers which cannot handle all non-control characters.
  676.       Also, since the technique does not affect the 8th bit, this does
  677.       not solve problems for communications links that can send only 7-
  678.       bit characters.
  679.  
  680.       A few examples may make this more clear.  Packet data is
  681.       transmitted on the link as follows:
  682.  
  683.          0x7e is encoded as 0x7d, 0x5e.
  684.          0x7d is encoded as 0x7d, 0x5d.
  685.          0x01 is encoded as 0x7d, 0x21.
  686.  
  687.  
  688.       Some modems with software flow control may intercept outgoing DC1
  689.       and DC3 ignoring the 8th (parity) bit.  This data would be
  690.       transmitted on the link as follows:
  691.  
  692.          0x11 is encoded as 0x7d, 0x31.
  693.          0x13 is encoded as 0x7d, 0x33.
  694.          0x91 is encoded as 0x7d, 0xb1.
  695.          0x93 is encoded as 0x7d, 0xb3.
  696.  
  697.  
  698.    Aborting a Transmission
  699.  
  700.       On asynchronous links, frames may be aborted by transmitting a "0"
  701.       stop bit where a "1" bit is expected (framing error) or by
  702.       transmitting a Control Escape octet followed immediately by a
  703.       closing Flag Sequence.
  704.  
  705.    Time Fill
  706.  
  707.       For asynchronous links, inter-octet and inter-frame time fill MUST
  708.       be accomplished by transmitting continuous "1" bits (mark-hold
  709.       state).
  710.  
  711.       Inter-frame time fill can be viewed as extended inter-octet time
  712.       fill.  Doing so can save one octet for every frame, decreasing
  713.       delay and increasing bandwidth.  This is possible since a Flag
  714.       Sequence may serve as both a frame close and a frame begin.  After
  715.  
  716.  
  717.  
  718. Simpson                  expires in six months                 [Page 12]
  719. DRAFT                         PPP Framing                      July 1993
  720.  
  721.  
  722.       having received any frame, an idle receiver will always be in a
  723.       frame begin state.
  724.  
  725.       Robust transmitters should avoid using this trick over-zealously
  726.       since the price for decreased delay is decreased reliability.
  727.       Noisy links may cause the receiver to receive garbage characters
  728.       and interpret them as part of an incoming frame.  If the
  729.       transmitter does not transmit a new opening Flag Sequence before
  730.       sending the next frame, then that frame will be appended to the
  731.       noise characters causing an invalid frame (with high reliability).
  732.       Transmitters should avoid this by transmitting an open Flag
  733.       Sequence whenever "appreciable time" has elapsed since the prior
  734.       closing Flag Sequence.  It is suggested that implementations will
  735.       achieve the best results by always sending an opening Flag
  736.       Sequence if the new frame is not back-to-back with the last.  The
  737.       maximum value for "appreciable time" is likely to be no greater
  738.       than the typing rate of a slow typist, say 1 second.
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773. Simpson                  expires in six months                 [Page 13]
  774. DRAFT                         PPP Framing                      July 1993
  775.  
  776.  
  777. A.  Fast Frame Check Sequence (FCS) Implementation
  778.  
  779.    The FCS was originally designed with hardware implementations in
  780.    mind.  A serial bit stream is transmitted on the wire, the FCS is
  781.    calculated over the serial data as it goes out, and the complement of
  782.    the resulting FCS is appended to the serial stream, followed by the
  783.    Flag Sequence.
  784.  
  785.    The receiver has no way of determining that it has finished
  786.    calculating the received FCS until it detects the Flag Sequence.
  787.    Therefore, the FCS was designed so that a particular pattern results
  788.    when the FCS operation passes over the complemented FCS.  A good
  789.    frame is indicated by this "good FCS" value.
  790.  
  791.  
  792. A.1.  FCS Computation Method
  793.  
  794.    The following code provides a table lookup computation for
  795.    calculating the Frame Check Sequence as data arrives at the
  796.    interface.  This implementation is based on [9], [10], and [11].  The
  797.    table is created by the code in section B.2.
  798.  
  799.    /*
  800.     * u16 represents an unsigned 16-bit number.  Adjust the typedef for
  801.     * your hardware.
  802.     */
  803.    typedef unsigned short u16;
  804.  
  805.  
  806.    /*
  807.     * FCS lookup table as calculated by the table generator in section B.2.
  808.     */
  809.    static u16 fcstab[256] = {
  810.       0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
  811.       0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
  812.       0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
  813.       0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
  814.       0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
  815.       0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
  816.       0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
  817.       0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
  818.       0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
  819.       0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
  820.       0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
  821.       0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
  822.       0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
  823.       0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
  824.       0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
  825.  
  826.  
  827.  
  828. Simpson                  expires in six months                 [Page 14]
  829. DRAFT                         PPP Framing                      July 1993
  830.  
  831.  
  832.       0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
  833.       0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
  834.       0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
  835.       0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
  836.       0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
  837.       0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
  838.       0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
  839.       0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
  840.       0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
  841.       0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
  842.       0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
  843.       0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
  844.       0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
  845.       0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
  846.       0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
  847.       0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
  848.       0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
  849.    };
  850.  
  851.    #define PPPINITFCS16    0xffff  /* Initial FCS value */
  852.    #define PPPGOODFCS16    0xf0b8  /* Good final FCS value */
  853.  
  854.    /*
  855.     * Calculate a new fcs given the current fcs and the new data.
  856.     */
  857.    u16 pppfcs16(fcs, cp, len)
  858.        register u16 fcs;
  859.        register unsigned char *cp;
  860.        register int len;
  861.    {
  862.        ASSERT(sizeof (u16) == 2);
  863.        ASSERT(((u16) -1) > 0);
  864.        while (len--)
  865.            fcs = (fcs >> 8) ^ fcstab[(fcs ^ *cp++) & 0xff];
  866.  
  867.        return (fcs);
  868.    }
  869.  
  870.    /*
  871.     * How to use the fcs
  872.     */
  873.    tryfcs16(cp, len)
  874.        register unsigned char *cp;
  875.        register int len;
  876.    {
  877.        u16 trialfcs;
  878.  
  879.        /* add on output */
  880.  
  881.  
  882.  
  883. Simpson                  expires in six months                 [Page 15]
  884. DRAFT                         PPP Framing                      July 1993
  885.  
  886.  
  887.        trialfcs = pppfcs16( PPPINITFCS16, cp, len );
  888.        trialfcs ^= 0xffff;                 /* complement */
  889.        cp[len] = (trialfcs & 0x00ff);      /* least significant byte first */
  890.        cp[len+1] = ((trialfcs >> 8) & 0x00ff);
  891.  
  892.        /* check on input */
  893.        trialfcs = pppfcs16( PPPINITFCS16, cp, len + 2 );
  894.        if ( trialfcs == PPPGOODFCS16 )
  895.            printf("Good FCS\n");
  896.    }
  897.  
  898.  
  899. A.2.  Fast FCS table generator
  900.  
  901.    The following code creates the lookup table used to calculate the
  902.    FCS.
  903.  
  904.    /*
  905.     * Generate a FCS table for the HDLC FCS.
  906.     *
  907.     * Drew D. Perkins at Carnegie Mellon University.
  908.     *
  909.     * Code liberally borrowed from Mohsen Banan and D. Hugh Redelmeier.
  910.     */
  911.  
  912.    /*
  913.     * The HDLC polynomial: x**0 + x**5 + x**12 + x**16 (0x8408).
  914.     */
  915.    #define P       0x8408
  916.  
  917.  
  918.    main()
  919.    {
  920.        register unsigned int b, v;
  921.        register int i;
  922.  
  923.        printf("typedef unsigned short u16;\n");
  924.        printf("static u16 fcstab[256] = {");
  925.        for (b = 0; ; ) {
  926.            if (b % 8 == 0)
  927.                printf("\n");
  928.  
  929.            v = b;
  930.            for (i = 8; i--; )
  931.                v = v & 1 ? (v >> 1) ^ P : v >> 1;
  932.  
  933.            printf("\t0x%04x", v & 0xFFFF);
  934.            if (++b == 256)
  935.  
  936.  
  937.  
  938. Simpson                  expires in six months                 [Page 16]
  939. DRAFT                         PPP Framing                      July 1993
  940.  
  941.  
  942.                break;
  943.            printf(",");
  944.        }
  945.        printf("\n};\n");
  946.    }
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993. Simpson                  expires in six months                 [Page 17]
  994. DRAFT                         PPP Framing                      July 1993
  995.  
  996.  
  997. Security Considerations
  998.  
  999.    Security issues are not discussed in this memo.
  1000.  
  1001. References
  1002.  
  1003.    [1]   Simpson, W. A., "The Point-to-Point Protocol (PPP)", work in
  1004.          progress.
  1005.  
  1006.    [2]   International Organization For Standardization, ISO Standard
  1007.          3309-1979, "Data communication - High-level data link control
  1008.          procedures - Frame structure", 1979.
  1009.  
  1010.    [3]   International Organization For Standardization, Proposed Draft
  1011.          International Standard ISO 3309:1983/PDAD1, "Information
  1012.          processing systems - Data communication - High-level data link
  1013.          control procedures - Frame structure - Addendum 1: Start/stop
  1014.          transmission", 1984.
  1015.  
  1016.    [4]   International Organization For Standardization, ISO Standard
  1017.          4335-1979, "Data communication - High-level data link control
  1018.          procedures - Elements of procedures", 1979.
  1019.  
  1020.    [5]   International Organization For Standardization, ISO Standard
  1021.          4335-1979/Addendum 1, "Data communication - High-level data
  1022.          link control procedures - Elements of procedures - Addendum 1",
  1023.          1979.
  1024.  
  1025.    [6]   International Telecommunication Union, CCITT Recommendation
  1026.          X.25, "Interface Between Data Terminal Equipment (DTE) and Data
  1027.          Circuit Terminating Equipment (DCE) for Terminals Operating in
  1028.          the Packet Mode on Public Data Networks", CCITT Red Book,
  1029.          Volume VIII, Fascicle VIII.3, Rec. X.25., October 1984.
  1030.  
  1031.    [7]   International Telegraph and Telephone Consultative Committee,
  1032.          CCITT Recommendation Q.922, "ISDN Data Link Layer Specification
  1033.          for Frame Mode Bearer Services", April 1991.
  1034.  
  1035.    [8]   American National Standards Institute, ANSI X3.4-1977,
  1036.          "American National Standard Code for Information Interchange",
  1037.          1977.
  1038.  
  1039.    [9]   Perez, "Byte-wise CRC Calculations", IEEE Micro, June, 1983.
  1040.  
  1041.    [10]  Morse, G., "Calculating CRC's by Bits and Bytes", Byte,
  1042.          September 1986.
  1043.  
  1044.    [11]  LeVan, J., "A Fast CRC", Byte, November 1987.
  1045.  
  1046.  
  1047.  
  1048. Simpson                  expires in six months                 [Page 18]
  1049. DRAFT                         PPP Framing                      July 1993
  1050.  
  1051.  
  1052. Acknowledgments
  1053.  
  1054.    This specification is based on previous RFCs, where many
  1055.    contributions have been acknowleged.
  1056.  
  1057.    Additional implementation detail for this version was provided by
  1058.    Fred Baker (ACC), and Craig Fox (NSC).
  1059.  
  1060.  
  1061. Chair's Address
  1062.  
  1063.    The working group can be contacted via the current chair:
  1064.  
  1065.       Fred Baker
  1066.       Advanced Computer Communications
  1067.       315 Bollay Drive
  1068.       Santa Barbara, California, 93111
  1069.  
  1070.       EMail: fbaker@acc.com
  1071.  
  1072.  
  1073. Author's Address
  1074.  
  1075.    Questions about this memo can also be directed to:
  1076.  
  1077.       William Allen Simpson
  1078.       Daydreamer
  1079.       Computer Systems Consulting Services
  1080.       P O Box 6205
  1081.       East Lansing, MI  48826-6205
  1082.  
  1083.       EMail: Bill.Simpson@um.cc.umich.edu
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103. Simpson                  expires in six months                 [Page 19]
  1104. DRAFT                         PPP Framing                      July 1993
  1105.  
  1106.  
  1107.                            Table of Contents
  1108.  
  1109.  
  1110.      1.     Introduction ..........................................    1
  1111.         1.1       Specification of Requirements ...................    1
  1112.         1.2       Terminology .....................................    1
  1113.  
  1114.      2.     Physical Layer Requirements ...........................    3
  1115.  
  1116.      3.     The Data Link Layer ...................................    5
  1117.         3.1       Frame Format ....................................    6
  1118.         3.2       Modification of the Basic Frame .................    8
  1119.  
  1120.      4.     Bit-synchronous HDLC ..................................    9
  1121.  
  1122.      5.     Asynchronous HDLC .....................................   11
  1123.  
  1124.      APPENDICES ...................................................   14
  1125.  
  1126.      A.     Fast Frame Check Sequence (FCS) Implementation ........   14
  1127.         A.1       FCS Computation Method ..........................   14
  1128.         A.2       Fast FCS table generator ........................   16
  1129.  
  1130.      SECURITY CONSIDERATIONS ......................................   18
  1131.  
  1132.      REFERENCES ...................................................   18
  1133.  
  1134.      ACKNOWLEDGEMENTS .............................................   19
  1135.  
  1136.      CHAIR'S ADDRESS ..............................................   19
  1137.  
  1138.      AUTHOR'S ADDRESS .............................................   19
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.